<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>肯德基优惠券</title>
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/couponslist.css">
</head>
<body>
     <!-- 头部标签 -->
        <header>
                <a class="return" href="javascript:;">
                    <!-- <span class="icon-left"></span> -->
                    <div></div>
                    <!-- <img src="./images/返回 (1).png" alt=""> -->
                </a>
                <span class="header-title">
                        优惠券
                </span>
                 <a class="download" href="javascript:;">
                     <img src="./images/header_app.png" alt="">
                 </a>
        </header>
        <div class="title">
            <p>--点餐前出示手机中的优惠券,即可享受优惠--</p>
        </div>
        <div class="food">
          <ul>
              
          </ul>
        </div>
</body>
</html>
<script src="./js/template.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/utils.js"></script>
<script type="text/template" id="couponslistTmp">
    {{each result as val key}}
        <li>
            <a href="javascript:;">
            {{val.couponProductImg}}
            <div class="cp-text">
                    <div class="cpName">{{val.couponProductName}}</div>
                    <div class="cpPrice">{{val.couponProductPrice}}</div>
                    <div class="cpTime">{{val.couponProductTime}}</div>
                </div>
                <!-- <div class="cp-right">
                    <img src="./images/next.png" alt="">
                </div> -->
            </a>
        </li>
      {{/each}}
</script>
<script>
        var id=URLHandle.parameter(location.search).couponid;
        // console.log(id);
        $.ajax({
            type:"get",
            url:"http://193.112.55.79:9090/api/getcouponproduct",
            data:{
                couponid:id
            },
            dataType:"jsonp",
            success:function(res){
                console.log(res);       
                template.config("escape", false)
                var str = template("couponslistTmp",res);
                $("ul").html(str);
            }
        })
       
        </script>